package com.wthink.newMain.serviceVoice.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.wthink.hzgj.BusApplication
import com.wthink.hzgj.data.Result
import com.wthink.hzgj.data.domain.FileDetail
import com.wthink.hzgj.service.DevService
import com.wthink.hzgj.util.toast
import com.wthink.newMain.data.ServiceVoiceDetail
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class ServiceVoiceViewmodel : ViewModel() {

    val serviceVoiceList = MutableLiveData(emptyList<ServiceVoiceDetail>())

    fun query() {
        viewModelScope.launch(Dispatchers.IO) {
            val serviceVoiceInfo = DevService.getServiceVoiceList()
            if (serviceVoiceInfo is Result.Success) {
                val list = serviceVoiceInfo.data.list
                serviceVoiceList.postValue(list)
            }
        }
    }
}